package com.manager.plat.action;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Test {
	public static String md5(String content) throws NoSuchAlgorithmException {
		MessageDigest md = MessageDigest.getInstance("MD5");
		md.update(content.getBytes());
		byte[] r = md.digest();
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < r.length; i++) {
			byte b = r[i];
			sb.append(Character.forDigit((b >> 4 & 0x0F), 16));
			sb.append(Character.forDigit((b & 0x0F), 16));
		}
		return sb.toString();
	}
	
	public static void main(String[] args) throws NoSuchAlgorithmException {
		Test test = new Test();
		String result = test.md5("huilkd123456");
		System.out.println(result);
		result = test.md5("gfgsfgsfgsfv34534**&");
		System.out.println(result);
	}
}
